#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
using namespace std;

class Solution {
public:
    int findLength(vector<int>& nums1, vector<int>& nums2) {
        int m = nums1.size(), n = nums2.size();
        vector<vector<int>> dp(m + 1, vector<int>(n + 1));
        int ret = 0;
        for (int i = 1; i <= m; ++i)
        {
            for (int j = 1; j <= n; ++j)
            {
                if (nums1[i - 1] == nums2[j - 1])
                    dp[i][j] = dp[i - 1][j - 1] + 1;
                ret = max(ret, dp[i][j]);
            }
        }
        return ret;
    }

    bool canPartition(vector<int>& nums) {
        int n = nums.size(), sum = 0;
        for (int num : nums)
        {
            sum += num;
        }
        if (sum & 1) return false;
        sum /= 2;
        vector<bool> dp(sum + 1);
        dp[0] = true;
        for (int i = 1; i <= n; ++i)
        {
            for (int j = sum; j >= nums[i - 1]; --j)
            {
                if (j - nums[i - 1] >= 0) dp[j] = dp[j] || dp[j - nums[i - 1]];
            }
        }
        return dp[sum];
    }

    int findTargetSumWays(vector<int>& nums, int target) {
        int n = nums.size(), sum = 0;
        for (int num : nums)
        {
            sum += num;
        }
        int aim = (sum + target) / 2;
        if (aim < 0 || (sum + target) & 1) return 0;
        vector<int> dp(aim + 1);
        dp[0] = 1;
        for (int i = 1; i <= n; ++i)
        {
            for (int j = aim; j >= 0; --j)
            {
                if (j - nums[i - 1] >= 0) dp[j] += dp[j - nums[i - 1]];
            }
        }
        return dp[aim];
    }
};

int Q2(int n, int v, const vector<int>& w, const vector<int>& val) {
    vector<int> dp(v + 1);
    int ret = -1;
    for (int i = 1; i <= v; ++i)
        dp[i] = -1;
    for (int i = 1; i <= n; ++i) {
        for (int j = v; j >= 0; --j) {
            dp[j] = dp[j];
            if (j >= w[i - 1] && dp[j - w[i - 1]] != -1) dp[j] = max(dp[j], dp[j - w[i - 1]] + val[i - 1]);
            ret = max(ret, dp[j]);
        }
    }
    return dp[v] == -1 ? 0 : dp[v];
}

int Q1(int n, int v, const vector<int>& w, const vector<int>& val) {
    vector<int> dp(v + 1);
    int ret = 0;
    for (int i = 1; i <= n; ++i) {
        for (int j = v; j >= 1; --j) {
            dp[j] = dp[j];
            if (j >= w[i - 1]) dp[j] = max(dp[j], dp[j - w[i - 1]] + val[i - 1]);
            ret = max(ret, dp[j]);
        }
    }
    return ret;
}
//
//int main() {
//    int n, v;
//    cin >> n >> v;
//    vector<int> w(n);
//    vector<int> val(n);
//    for (int i = 0; i < n; ++i) {
//        cin >> w[i] >> val[i];
//    }
//    cout << Q1(n, v, w, val) << endl;
//    cout << Q2(n, v, w, val) << endl;
//    return 0;
//}


#include<iostream>
#include<vector>
using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> nums(n);
    vector<int> finds(m);
    for (int i = 0; i < n; ++i)
        cin >> nums[i];
    for (int i = 0; i < m; ++i)
        cin >> finds[i];
    for (int f : finds)
    {
        int left = 0, right = n - 1;
        while (left < right)
        {
            int mid = (left + right) >> 1;
            if (nums[mid] >= f) right = mid;
            else if (nums[mid] < f) left = mid + 1;
        }
        if (nums[left] == f) cout << left + 1 << " ";
        else cout << -1 << " ";
    }
    return 0;
}